Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Cython vs Numba.ipynb #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

robertwb
Copy link

The primary difference in Numba vs. Cython here is that Cython refuses by default to infer fixed-size integer types for ints used in arithmetic (to avoid changing overflow behavior).

The primary difference in Numba vs. Cython here is that Cython refuses by default to infer fixed-size integer types for ints used in arithmetic (to avoid changing overflow behavior).
@elgehelge
Copy link
Owner

Wow. I did not know about that. This makes it much easier to use Cython. But can you tell me a little bit about the drawback of doing this. Why is it not the default?

@robertwb
Copy link
Author

The goal is to be able to take your Python code, compile it with Cython,
and have it behave exactly the same. If you have (for example)

def squares(a, b):
for k in range(a, b):
print k*k

this will overflow whenever b > sqrt(sys.maxint). Even k+1 could overflow.

Granted, our heuristics are probably a bit too conservative. For
floats/doubles it's easy--we always infer.

On Thu, Jan 14, 2016 at 9:35 AM, Helge Munk Jacobsen <
[email protected]> wrote:

Wow. I did not know about that. This makes it much easier to use Cython.
But can you tell me a little bit about the drawback of doing this. Why is
it not the default?


Reply to this email directly or view it on GitHub
#1 (comment)
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants